🌎 rns.kin.earth git 🌍
Commit a2e856762c4088a06c403db1c2fdae505c08d4b2
Parents : 06a43f6
Author : Mark Qvist <mark@adepta.io>
Date : 2020-05-13T16:02:37+02:00
Relaxed outbound error handling
Changes
Diff
diff --git a/RNS/Packet.py b/RNS/Packet.py
index de1e5823..2bddce14 100755
--- a/RNS/Packet.py
+++ b/RNS/Packet.py
@@ -175,6 +175,9 @@ class Packet:
self.packed = False
self.updateHash()
+ # Sends the packet. Returns a receipt if one is generated,
+ # or None if no receipt is available. Returns False if the
+ # packet could not be sent.
def send(self):
if not self.sent:
if self.destination.type == RNS.Destination.LINK:
@@ -191,9 +194,11 @@ class Packet:
if RNS.Transport.outbound(self):
return self.receipt
else:
- # TODO: Decide whether this failure should simply
- # return none, or raise an error
- raise IOError("No interfaces could process the outbound packet")
+ RNS.log("No interfaces could process the outbound packet", RNS.LOG_ERROR)
+ self.sent = False
+ self.receipt = None
+ return False
+
else:
raise IOError("Packet was already sent")
@@ -202,8 +207,10 @@ class Packet:
if RNS.Transport.outbound(self):
return self.receipt
else:
- # TODO: Don't raise error here, handle gracefully
- raise IOError("Packet could not be sent! Do you have any outbound interfaces configured?")
+ RNS.log("No interfaces could process the outbound packet", RNS.LOG_ERROR)
+ self.sent = False
+ self.receipt = None
+ return False
else:
raise IOError("Packet was not sent yet")
Served by rngit 1.5.2 - Generated in 0.06s